﻿using System.Reflection;
using System.Configuration;
using KPIS.GERP.GBMS.DAL;

namespace KPIS.GERP.GBMS.DALFactory
{
    public class DataAccess
    {
        private static readonly string path = ConfigurationManager.AppSettings["WebDAL"];

        private DataAccess() { }

        // ----------------------------- Master Data -----------------------------------------------

        public static ISourceTypeDAL CreateSourceType()
        {
            string className = path + ".SourceTypeDAL";
            return (ISourceTypeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ISourceDAL CreateSource()
        {
            string className = path + ".SourceDAL";
            return (ISourceDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IOptionDAL CreateOption()
        {
            string className = path + ".OptionDAL";
            return (IOptionDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IExpenseGroupDAL CreateExpenseGroup()
        {
            string className = path + ".ExpenseGroupDAL";
            return (IExpenseGroupDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IExpenseDAL CreateExpense()
        {
            string className = path + ".ExpenseDAL";
            return (IExpenseDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IExpenseRateTypeDAL CreateExpenseRateType()
        {
            string className = path + ".ExpenseRateTypeDAL";
            return (IExpenseRateTypeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IExpenseRateDtlsDAL CreateExpenseRateDtls()
        {
            string className = path + ".ExpenseRateDtlsDAL";
            return (IExpenseRateDtlsDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IOptionDAL CreateOptionList()
        {
            string className = path + ".OptionDAL";
            return (IOptionDAL)Assembly.Load(path).CreateInstance(className);
        }
        // ---------------------------------------------------------------------------------------------------
        // --------------------------------- Strategy Data -------------------------------------------------

        public static IStrategyMissionDAL CreateStrategyMission()
        {
            string className = path + ".StrategyMissionDAL";
            return (IStrategyMissionDAL)Assembly.Load(path).CreateInstance(className);
        }


        public static IStrategyVisionDAL CreateStrategyVision()
        {
            string className = path + ".StrategyVisionDAL";
            return (IStrategyVisionDAL)Assembly.Load(path).CreateInstance(className);
        }


        public static IStrategyTypeDAL CreateStrategyType()
        {
            string className = path + ".StrategyTypeDAL";
            return (IStrategyTypeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IStrategyDataDAL CreateStrategyDataList()
        {
            string className = path + ".StrategyDataListDAL";
            return (IStrategyDataDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBGMKPIResultListDAL CreateBGMKPIResultList()
        {
            string className = path + ".BGMKPIResultListDAL";
            return (IBGMKPIResultListDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IStrategyDataMappingDAL CreateStrategyDataMapping()
        {
            string className = path + ".StrategyDataMappingDAL";
            return (IStrategyDataMappingDAL)Assembly.Load(path).CreateInstance(className);
        }

        // ------------------------------------------------------------------------------------------------------
        // ------------------------------------ Budgeting Data -----------------------------------------------

        public static IProjectRequestDAL CreateProject()
        {
            string className = path + ".ProjectRequestDAL";
            return (IProjectRequestDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IProjectRequestExpenseDAL CreateProjectExpense()
        {
            string className = path + ".ProjectRequestExpenseDAL";
            return (IProjectRequestExpenseDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IRequestExpensePlanDAL CreateRequestExpensePlan()
        {
            string className = path + ".RequestExpensePlanDAL";
            return (IRequestExpensePlanDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IProjectRequestOptionDAL CreateProjectOption()
        {
            string className = path + ".ProjectRequestOptionDAL";
            return (IProjectRequestOptionDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IProjectRequestKPIDAL CreateProjectKPI()
        {
            string className = path + ".ProjectRequestKPIDAL";
            return (IProjectRequestKPIDAL)Assembly.Load(path).CreateInstance(className);
        }
        public static IProjectReaderDtlsDAL CreateProjectReader()
        {
            string className = path + ".ProjectReaderDtlsDAL";
            return (IProjectReaderDtlsDAL)Assembly.Load(path).CreateInstance(className);
        }
        public static IBgmKpiListDAL CreateBgmKpiList()
        {
            string className = path + ".BgmKpiListDAL";
            return (IBgmKpiListDAL)Assembly.Load(path).CreateInstance(className);
        }
        // ------------------------------------------------------------------------------------------------------
        // ------------------------------------------ System Data --------------------------------------------
        public static IOptionTypeDAL CreateOptionTypeList()
        {
            string className = path + ".OptionTypeDAL";
            return (IOptionTypeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ISystemMenuDAL CreateSystemMenu()
        {
            string className = path + ".SystemMenuDAL";
            return (ISystemMenuDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IProjectJobAssigneeListDAL CreateProjectJobAssigneeList()
        {
            string className = path + ".ProjectJobAssigneeListDAL";
            return (IProjectJobAssigneeListDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IMaiTestTreeNodeDAL CreatePositions() //Creat for Test
        {
            string className = path + ".PositionDAL";
            return (IMaiTestTreeNodeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBGMProjectPaymentReportDAL LoadProjectPaymentReport() //Creat for Test
        {
            string className = path + ".BGMProjectPaymentReportDAL";
            return (IBGMProjectPaymentReportDAL)Assembly.Load(path).CreateInstance(className);
        }
    }
}
